package cn.northsea.utils;

import java.util.HashMap;
import java.util.Map;

public class SendSms {
    public static void main(String[] args) {
//        DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou",
//                "LTAI5tQypYRLwUKGVc23MrHx", "xTMdOFT8vz2PwEVbExwdce6CzWcaP1");
//        IAcsClient client = new DefaultAcsClient(profile);
//        CommonRequest request = new CommonRequest();
//        request.setMethod(MethodType.POST);//设置post提交
//        request.setDomain("dysmsapi.aliyuncs.com");//短信API产品域名（接口地址固定，无需修改）
//        request.setVersion("2017-05-25");
//        request.setAction("SendSms");
//        request.putQueryParameter("RegionId", "cn-hangzhou");
//        request.putQueryParameter("PhoneNumbers", "15551725506");
//        request.putQueryParameter("SignName", "erp仓库管理");//短信签名
//        request.putQueryParameter("TemplateCode", "SMS_475785065");
//        request.putQueryParameter("TemplateParam", "{\"code\":\"2111\"}");
//        try {
//            CommonResponse response = client.getCommonResponse(request);
//            System.out.println(response.getData());
//        }
//            catch (ServerException e) {
//                throw new RuntimeException(e);
//            }
//            catch (ClientException e) {
//                  throw new RuntimeException(e);
//             }
        Map<String, String> map = new HashMap<>();
        map.put("phoneNumbers", "15551725506");
        map.put("signName", "erp仓库管理");
        map.put("templateCode", "SMS_475785065");
        map.put("templateParam", "{\"code\":\"6666\"}");
        Boolean sms_result = AliyunSmsUtils.sendSms(map);
        System.out.println("工具类短信发送是否成功："+sms_result);
    }
}
